home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-02-07 | 2.2 KB | 110 lines | [TEXT/MPS ] |
- (****************************)
- (* file: ADSPTalk.p *)
- (* *)
- (* Send information to an *)
- (* established connection. *)
- (* The connection must be *)
- (* been established via the *)
- (* ADSPCALL xcmd. *)
- (* *)
- (* In: *)
- (* params[1] = entity name *)
- (* of the remote end. *)
- (* *)
- (* ------------------------ *)
- (* By: Donald Koscheka *)
- (* Date: 2-Mar-89 *)
- (* All Rights Reserved *)
- (* *)
- (* ------------------------ *)
- (****************************)
-
- (*****************************
- Build Sequence
-
- pascal -o ADSPTalk.p.o ADSPTalk.p
- link -m ENTRYPOINT -rt XCMD=1305 -sn Main=ADSPTalk∂
- ADSPTalk.p.o∂
- "{libraries}"Interface.o ∂
- -o YourStackNameHere
-
- *****************************)
-
-
- {$R-}
- {$S ADSPTalk}
- UNIT DummyUnit;
-
- (****************************)
- INTERFACE
- (****************************)
-
-
- Uses MemTypes, QuickDraw, OSIntf,
- ToolIntf, PackIntf, HyperXCmd,
- AppleTalk, ADSP, adspxcmd;
-
-
- Procedure EntryPoint( paramPtr : XCmdPtr );
-
-
-
- (****************************)
- IMPLEMENTATION
- (****************************)
- TYPE Str31 = String[31];
-
-
- PROCEDURE ADSPTalk( paramPtr: XCmdPtr ); FORWARD;
-
- Procedure EntryPoint( paramPtr : XCmdPtr );
- Begin
- ADSPTalk( paramPtr );
- End;
-
-
- Procedure ADSPTalk( paramPtr : XCmdPtr );
- VAR
- adsp : ADSPPtr;
- error : OSErr;
- eAddr : AddrBlock;
- cb : cbPtr;
-
- {$I XCmdGlue.inc }
- {$I XCMDADSP.inc }
-
- BEGIN
- error := noErr;
- adsp := ADSPPtr(RetrieveData( 'GLOBALDSPDATA' ));
- IF (adsp <> NIL)
- AND (paramPtr^.params[1] <> NIL)
- AND (paramPtr^.params[2] <> NIL) THEN
- BEGIN
- adsp^.checkPoint := RECEIVING;
- {*** (1) Get the entity's address ***}
- HLock( paramPtr^.params[1] );
-
- eAddr := NBPGetAddress( paramPtr^.params[1]^ );
- cb := adsp^.ends;
-
- {*** (2) Find entity in connection list***}
- IF LongInt( eAddr ) <> 0 THEN
- WHILE cb <> NIL DO
- IF (LongInt(cb^.adr)=LongInt(eAddr))
- AND (cb^.ccb.state=sOpen) THEN
- BEGIN
- error := DSPTalk(cb, paramPtr^.params[2] );
- cb := NIL;
- END
- ELSE
- cb := cb^.next;
-
- adsp^.checkPoint := CLOSE_OK;
- HUnlock( Handle(paramPtr^.params[1]) );
- END;
- paramPtr^.returnValue := PasToZero( NumToStr( LongInt(error) ) );
- END;
-
-
- end.
-